home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Metrowerks CodeWarrior / Java Support / Java_Source / IFC_112 / netscape / application / Slider.java < prev    next >
Encoding:
Text File  |  1999-05-28  |  19.7 KB  |  696 lines  |  [TEXT/CWIE]

  1. // Slider.java
  2. // By Ned Etcode
  3. // Copyright 1995, 1996, 1997 Netscape Communications Corp. All rights reserved.
  4.  
  5. package netscape.application;
  6.  
  7. import netscape.util.*;
  8.  
  9.  
  10. /** View subclass that implements a "slider," an analog control device that
  11.   * allows the user to drag a knob to select the Slider's value. As the
  12.   * Slider changes its value, it sends a command to its Target.
  13.   * @note 1.0 removed Component
  14.   * @note 1.0 added keyboard ui, archiving changed
  15.   * @note 1.0 didSizeBy() will redraw knob appropriately positioned
  16.   * @note 1.0 Added FormElement interface for browser needs
  17.   */
  18. public class Slider extends View implements Target, FormElement {
  19.     Target      target;
  20.     Border      border = BezelBorder.loweredBezel();
  21.     Image       backgroundImage, knobImage;
  22.     Color       backgroundColor = Color.gray;
  23.     String      command;
  24.     int         value, minValue, maxValue, sliderX, knobHeight,
  25.                 grooveHeight, clickOffset, imageDisplayStyle;
  26.     boolean     enabled = true;
  27.     int         incrementResolution;
  28.     static Vector    _fieldDescription;
  29.  
  30.     private static final int  SLIDER_KNOB_WIDTH = 6;
  31.  
  32.     static final String         TARGET_KEY = "target",
  33.                                 BACKGROUND_IMAGE_KEY = "backgroundImage",
  34.                                 KNOB_IMAGE_KEY = "knobImage",
  35.                                 BACKGROUNDC_KEY = "backgroundColor",
  36.                                 COMMAND_KEY = "command",
  37.                                 VALUE_KEY = "value",
  38.                                 MINVALUE_KEY = "minValue",
  39.                                 MAXVALUE_KEY = "maxValue",
  40.                                 KNOB_HEIGHT_KEY = "knobHeight",
  41.                                 GROOVE_HEIGHT_KEY = "grooveHeight",
  42.                                 BORDER_KEY = "border",
  43.                                 ENABLED_KEY = "enabled",
  44.                                 IMAGEDISP_KEY = "imageDisplayStyle",
  45.                                 INC_RES_KEY = "incrementResolution";
  46.  
  47.     /** Increase the slider value
  48.       *
  49.       */
  50.     public static final String INCREASE_VALUE = "increaseValue";
  51.  
  52.     /** Decrease the slider value
  53.       *
  54.       */
  55.     public static final String DECREASE_VALUE = "decreaseValue";
  56.  
  57.  
  58.     /* constructors */
  59.  
  60.     /** Constructs a Slider with origin (<b>0</b>, <b>0</b>) and zero
  61.       * width and height.
  62.       */
  63.     public Slider() {
  64.         this(0, 0, 0, 0);
  65.     }
  66.  
  67.     /** Constructs a Slider with bounds <B>rect</B>.
  68.       */
  69.     public Slider(Rect rect) {
  70.         this(rect.x, rect.y, rect.width, rect.height);
  71.     }
  72.  
  73.     /** Constructs a Slider with bounds
  74.       * (<B>x</B>, <B>y</B>, <B>width</B>, <B>height</B>).
  75.       */
  76.     public Slider(int x, int y, int width, int height) {
  77.         super(x, y, width, height);
  78.  
  79.         knobHeight = 13;
  80.         grooveHeight = 8;
  81.  
  82.         minValue = 0;
  83.         maxValue = 255;
  84.  
  85.         setValue(0);
  86.         _setupKeyboard();
  87.         incrementResolution = 20;
  88.     }
  89.  
  90.     private static int parseInt(String s) {
  91.         try {
  92.             return Integer.parseInt(s);
  93.         } catch (NumberFormatException e) {
  94.             return 0;
  95.         }
  96.     }
  97.  
  98. /* attributes/actions */
  99.  
  100.     /** Overridden to return the Slider's minimum size.
  101.       */
  102.     public Size minSize() {
  103.         if (_minSize != null) {
  104.             return new Size(_minSize);
  105.         }
  106.  
  107.         return new Size(knobWidth() + 2,
  108.                 (knobHeight > grooveHeight ? knobHeight : grooveHeight));
  109.     }
  110.  
  111.     /** Sets the Slider's minimum and maximum values.  Modifies the Slider's
  112.       * current value to fit within this new range (if outside of the range).
  113.       */
  114.     public void setLimits(int minValue, int maxValue) {
  115.         int     realValue;
  116.  
  117.         if (minValue >= maxValue) {
  118.             return;
  119.         }
  120.  
  121.         this.minValue = minValue;
  122.         this.maxValue = maxValue;
  123.  
  124.         /* clip */
  125.         if (value < minValue) {
  126.             value = minValue;
  127.         } else if (value > maxValue) {
  128.             value = maxValue;
  129.         }
  130.  
  131.         /* position knob and redraw */
  132.         realValue = value;
  133.         if (value > 0) {
  134.             value--;
  135.         } else {
  136.             value++;
  137.         }
  138.         setValue(realValue);
  139.     }
  140.  
  141.     /** Returns the Slider's minimum value.
  142.       * @see #setLimits
  143.       */
  144.     public int minValue() {
  145.         return minValue;
  146.     }
  147.  
  148.     /** Returns the Slider's maximum value.
  149.       * @see #setLimits
  150.       */
  151.     public int maxValue() {
  152.         return maxValue;
  153.     }
  154.  
  155.     /** Sets the Image displayed by the Slider as its "knob."  If set,
  156.       * the Slider will display this Image rather than draw a bezeled
  157.       * knob.
  158.       */
  159.     public void setKnobImage(Image anImage) {
  160.         if (anImage == knobImage) {
  161.             return;
  162.         }
  163.  
  164.         knobImage = anImage;
  165.         if (anImage != null) {
  166.             knobHeight = anImage.height();
  167.         }
  168.  
  169.         /* reposition knob and redraw */
  170.         setValue(value);
  171.     }
  172.  
  173.     /** Returns the Image displayed by the Slider as its "knob."
  174.       * @see #setKnobImage
  175.       */
  176.     public Image knobImage() {
  177.         return knobImage;
  178.     }
  179.  
  180.     /** Sets the Color the Slider displays within its groove if it has no
  181.       * image.
  182.       */
  183.     public void setBackgroundColor(Color aColor) {
  184.         if (backgroundColor != null) {
  185.             backgroundColor = aColor;
  186.         }
  187.     }
  188.  
  189.     /** Returns the Color the Slider displays within its groove.
  190.       * @see #setBackgroundColor
  191.       */
  192.     public Color backgroundColor() {
  193.         return backgroundColor;
  194.     }
  195.  
  196.     /** Sets the Image the Slider displays within its groove.
  197.       */
  198.     public void setImage(Image anImage) {
  199.         backgroundImage = anImage;
  200.     }
  201.  
  202.     /** Returns the Image the Slider displays within its groove.
  203.       * @see #setImage
  204.       */
  205.     public Image image() {
  206.         return backgroundImage;
  207.     }
  208.  
  209.     /** Tells the Slider how to display its Image (<b>Image.CENTERED</b>,
  210.       * <b>Image.TILED</b>, or <b>Image.SCALED</b>).
  211.       * @see #setImage
  212.       */
  213.     public void setImageDisplayStyle(int aStyle) {
  214.         if (aStyle != Image.CENTERED && aStyle != Image.TILED &&
  215.             aStyle != Image.SCALED) {
  216.             throw new InconsistencyException("Unknown image display style: " +
  217.                 aStyle);
  218.         }
  219.  
  220.         imageDisplayStyle = aStyle;
  221.         draw();
  222.     }
  223.  
  224.     /** Returns the style the Slider uses to display its Image.
  225.       * @see #setImageDisplayStyle
  226.       */
  227.     public int imageDisplayStyle() {
  228.         return imageDisplayStyle;
  229.     }
  230.  
  231.     /** Sets the Slider's Target, the object the Slider notifies when the
  232.       * user changes its value.
  233.       * @see Target
  234.       */
  235.     public void setTarget(Target aTarget) {
  236.         target = aTarget;
  237.     }
  238.  
  239.     /** Returns the Slider's Target.
  240.       * @see #setTarget
  241.       */
  242.     public Target target() {
  243.         return target;
  244.     }
  245.  
  246.     /** Sets the command the Slider sends to its Target.
  247.       * @see #setTarget
  248.       */
  249.     public void setCommand(String command) {
  250.         this.command = command;
  251.     }
  252.  
  253.     /** Returns the command the Slider sends to its Target.
  254.       * @see #setCommand
  255.       */
  256.     public String command() {
  257.         return command;
  258.     }
  259.  
  260.     /** Called by the Slider to send its command to its Target.
  261.       * @see #setTarget
  262.       */
  263.     public void sendCommand() {
  264.         if (target != null) {
  265.             target.performCommand(command, this);
  266.         }
  267.     }
  268.  
  269.     /** Sets the Slider's "enabled" state and then calls the Slider's
  270.       * <B>draw()</B> method to redraw it.  A disabled Slider does not
  271.       * respond to mouse clicks or drags.
  272.       */
  273.     public void setEnabled(boolean enabled) {
  274.         if (enabled != this.enabled) {
  275.             this.enabled = enabled;
  276.  
  277.             draw();
  278.         }
  279.     }
  280.  
  281.     /** Returns <B>true</b> is the Slider is enabled.
  282.       * @see #setEnabled
  283.       */
  284.     public boolean isEnabled() {
  285.         return enabled;
  286.     }
  287.  
  288.     /** Returns the width of the Slider's knob.  Override when subclassing
  289.       * if you want to draw a special knob.
  290.       */
  291.     public int knobWidth() {
  292.         if (knobImage != null) {
  293.             return knobImage.width();
  294.         }
  295.  
  296.         return SLIDER_KNOB_WIDTH;
  297.     }
  298.  
  299.     /** Sets the Slider's knob height.
  300.       */
  301.     public void setKnobHeight(int anInt) {
  302.         if (anInt > 0) {
  303.             knobHeight = anInt;
  304.         }
  305.     }
  306.  
  307.     /** Returns the Slider's knob height.
  308.       * @see #setKnobHeight
  309.       */
  310.     public int knobHeight() {
  311.         return knobHeight;
  312.     }
  313.  
  314.     /** Sets the Slider's groove height.
  315.       */
  316.     public void setGrooveHeight(int anInt) {
  317.         if (anInt > 0) {
  318.             grooveHeight = anInt;
  319.         }
  320.     }
  321.  
  322.     /** Returns the Slider's groove height.
  323.       * @see #setKnobHeight
  324.       */
  325.     public int grooveHeight() {
  326.         return grooveHeight;
  327.     }
  328.  
  329.     /** Sets the Border the Slider draws around its groove.
  330.       */
  331.     public void setBorder(Border newBorder) {
  332.         if (newBorder == null)
  333.             newBorder = EmptyBorder.emptyBorder();
  334.  
  335.         border = newBorder;
  336.         setValue(value);
  337.     }
  338.  
  339.     /** Returns the Border the Slider draws around its groove.
  340.       * @see #setBorder
  341.       */
  342.     public Border border() {
  343.         return border;
  344.     }
  345.  
  346.     void redrawView(int oldSliderX) {
  347.         Rect    tmpRect;
  348.  
  349.         if (sliderX == oldSliderX) {
  350.             return;
  351.         }
  352.  
  353.         if (sliderX < oldSliderX) {
  354.             tmpRect = Rect.newRect(sliderX, 0,
  355.                                    oldSliderX - sliderX + knobWidth(),
  356.                                    bounds.height);
  357.         } else {
  358.             tmpRect = Rect.newRect(oldSliderX, 0,
  359.                                    sliderX - oldSliderX + knobWidth(),
  360.                                    bounds.height);
  361.         }
  362.  
  363.         draw(tmpRect);
  364.  
  365.         Rect.returnRect(tmpRect);
  366.     }
  367.  
  368.     /** Computes the normalized position of the slider relative to its
  369.       * physical size and its numerical value.  Called by setValue() and
  370.       * didSizeBy().
  371.       */
  372.     void recomputeSliderPosition() {
  373.         float   normalizedMaxValue;
  374.         int     normalizedValue;
  375.  
  376.         normalizedValue = value - minValue;
  377.         normalizedMaxValue = (maxValue - minValue) * 1.0f;
  378.         sliderX = (int)((normalizedValue/ normalizedMaxValue) *
  379.                                           (bounds.width - knobWidth()));
  380.     }
  381.  
  382.     /** Sets the Slider's value and redraws the Slider.  If less than
  383.       * <b>minValue()</b> or greater than <b>maxValue()</b>, does nothing.
  384.       */
  385.     public void setValue(int aValue) {
  386.         Rect    updateRect;
  387.         float   normalizedMaxValue;
  388.         int     oldX, normalizedValue;
  389.  
  390.         if (aValue < minValue || aValue > maxValue) {
  391.             return;
  392.         }
  393.  
  394.         if (value != aValue) {
  395.             value = aValue;
  396.             oldX = sliderX;
  397.             recomputeSliderPosition();
  398.             redrawView(oldX);
  399.         }
  400.     }
  401.  
  402.     /** Returns the Slider's value.
  403.       * @see #setValue
  404.       */
  405.     public int value() {
  406.         return value;
  407.     }
  408.  
  409.     /** Draws the Slider's groove, which includes its Border and contents.
  410.       * You never call this method directly, but should override it to
  411.       * implement custom groove drawing.
  412.       */
  413.     public void drawViewGroove(Graphics g) {
  414.         Rect    tmpRect;
  415.         int     yOffset;
  416.  
  417.         yOffset = (bounds.height - grooveHeight) / 2;
  418.         tmpRect = Rect.newRect(0, yOffset, bounds.width, grooveHeight);
  419.  
  420.         border.drawInRect(g, tmpRect);
  421.         border.computeInteriorRect(tmpRect, tmpRect);
  422.  
  423.         if (backgroundImage != null) {
  424.             g.pushState();
  425.             g.setClipRect(tmpRect);
  426.             backgroundImage.drawWithStyle(g, tmpRect, imageDisplayStyle);
  427.             g.popState();
  428.         } else {
  429.             if (!enabled) {
  430.                 g.setColor(Color.lightGray);
  431.             } else {
  432.                 g.setColor(backgroundColor);
  433.             }
  434.  
  435.             g.fillRect(tmpRect);
  436.         }
  437.  
  438.         Rect.returnRect(tmpRect);
  439.     }
  440.  
  441.     /** Returns a Rect containing the Slider's knob.
  442.       */
  443.     public Rect knobRect() {
  444.         int     y;
  445.  
  446.         if (knobImage != null) {
  447.             y = (bounds.height - knobImage.height()) / 2;
  448.         } else {
  449.             y = (bounds.height - grooveHeight) / 2 -
  450.                 (knobHeight - grooveHeight) / 2;
  451.         }
  452.         return Rect.newRect(sliderX, y, knobWidth(), knobHeight);
  453.     }
  454.  
  455.     /** Draws the Slider's knob.  You never call this method directly, but
  456.       * should override it to implement custom knob drawing.
  457.       */
  458.     public void drawViewKnob(Graphics g) {
  459.         Rect    knobRect;
  460.  
  461.         knobRect = knobRect();
  462.         if (knobImage != null) {
  463.             knobImage.drawAt(g, knobRect.x, knobRect.y);
  464.         } else {
  465.             BezelBorder.raisedButtonBezel().drawInRect(g, knobRect);
  466.             g.setColor(Color.lightGray);
  467.             g.fillRect(knobRect.x + 2, knobRect.y + 2, knobRect.width - 4,
  468.                        knobRect.height - 4);
  469.         }
  470.         Rect.returnRect(knobRect);
  471.     }
  472.  
  473.     /** Draws the Slider.  Calls <b>drawViewGroove()</b> and
  474.       * <b>drawViewKnob()</b>.
  475.       * @see #drawViewGroove
  476.       * @see #drawViewKnob
  477.       */
  478.     public void drawView(Graphics g) {
  479.         drawViewGroove(g);
  480.         drawViewKnob(g);
  481.     }
  482.  
  483.     int _positionFromPoint(int point) {
  484.         int     knobWidth;
  485.  
  486.         knobWidth = knobWidth();
  487.         point -= knobWidth / 2;
  488.  
  489.         if (point < 0) {
  490.             point = 0;
  491.         } else if (point > bounds.width - knobWidth) {
  492.             point = bounds.width - knobWidth;
  493.         }
  494.  
  495.         return point;
  496.     }
  497.  
  498.     void _moveSliderTo(int point) {
  499.         int     oldX;
  500.  
  501.         oldX = sliderX;
  502.  
  503.         sliderX = _positionFromPoint(point);
  504.         value = (int)((((maxValue - minValue) * 1.0) /
  505.                             (float)(bounds.width - knobWidth())) * sliderX) +
  506.                                                                     minValue;
  507.  
  508.         redrawView(oldX);
  509.     }
  510.  
  511.     /** Overridden to reposition the Slider's knob when resized.
  512.       */
  513.     public void didSizeBy(int deltaWidth, int deltaHeight) {
  514.         recomputeSliderPosition();
  515.         super.didSizeBy(deltaWidth, deltaHeight);
  516.     }
  517.  
  518.     /** Overridden to implement knob dragging and send the Slider's command
  519.       * to its Target.
  520.       * @see #sendCommand
  521.       */
  522.     public boolean mouseDown(MouseEvent event) {
  523.         Rect    knobRect;
  524.  
  525.         if (!enabled) {
  526.             return false;
  527.         }
  528.  
  529.         knobRect = knobRect();
  530.         if (knobRect.contains(event.x, event.y)) {
  531.             clickOffset = _positionFromPoint(event.x) - sliderX;
  532.         } else {
  533.             clickOffset = 0;
  534.             _moveSliderTo(event.x);
  535.         }
  536.  
  537.         sendCommand();
  538.  
  539.         return true;
  540.     }
  541.  
  542.     /** Overridden to implement knob dragging and send the Slider's command
  543.       * to its Target.
  544.       * @see #sendCommand
  545.       */
  546.     public void mouseDragged(MouseEvent event) {
  547.         _moveSliderTo(event.x - clickOffset);
  548.  
  549.         sendCommand();
  550.     }
  551.  
  552.  
  553.  
  554. /* archiving */
  555.  
  556.  
  557.     /** Describes the Slider class' information.
  558.      * @see Codable#describeClassInfo
  559.      */
  560.     public void describeClassInfo(ClassInfo info) {
  561.         super.describeClassInfo(info);
  562.  
  563.         info.addClass("netscape.application.Slider", 2);
  564.         info.addField(TARGET_KEY, OBJECT_TYPE);
  565.         info.addField(BACKGROUND_IMAGE_KEY, OBJECT_TYPE);
  566.         info.addField(KNOB_IMAGE_KEY, OBJECT_TYPE);
  567.         info.addField(BACKGROUNDC_KEY, OBJECT_TYPE);
  568.         info.addField(BORDER_KEY, OBJECT_TYPE);
  569.         info.addField(COMMAND_KEY, STRING_TYPE);
  570.         info.addField(VALUE_KEY, INT_TYPE);
  571.         info.addField(MINVALUE_KEY, INT_TYPE);
  572.         info.addField(MAXVALUE_KEY, INT_TYPE);
  573.         info.addField(KNOB_HEIGHT_KEY, INT_TYPE);
  574.         info.addField(GROOVE_HEIGHT_KEY, INT_TYPE);
  575.         info.addField(IMAGEDISP_KEY, INT_TYPE);
  576.         info.addField(ENABLED_KEY, BOOLEAN_TYPE);
  577.         info.addField(INC_RES_KEY,INT_TYPE);
  578.     }
  579.  
  580.     /** Encodes the Slider instance.
  581.      * @see Codable#encode
  582.      */
  583.     public void encode(Encoder encoder) throws CodingException {
  584.         super.encode(encoder);
  585.  
  586.         encoder.encodeObject(TARGET_KEY, (Codable)target);
  587.         encoder.encodeObject(BACKGROUND_IMAGE_KEY, backgroundImage);
  588.         encoder.encodeObject(KNOB_IMAGE_KEY, knobImage);
  589.         encoder.encodeObject(BACKGROUNDC_KEY, backgroundColor);
  590.  
  591.         encoder.encodeString(COMMAND_KEY, command);
  592.  
  593.         encoder.encodeInt(VALUE_KEY, value);
  594.         encoder.encodeInt(MINVALUE_KEY, minValue);
  595.         encoder.encodeInt(MAXVALUE_KEY, maxValue);
  596.         encoder.encodeInt(KNOB_HEIGHT_KEY, knobHeight);
  597.         encoder.encodeInt(GROOVE_HEIGHT_KEY, grooveHeight);
  598.  
  599.         if (border instanceof EmptyBorder)
  600.             encoder.encodeObject(BORDER_KEY, null);
  601.         else
  602.             encoder.encodeObject(BORDER_KEY, border);
  603.  
  604.         encoder.encodeBoolean(ENABLED_KEY, enabled);
  605.         encoder.encodeInt(IMAGEDISP_KEY, imageDisplayStyle);
  606.         encoder.encodeInt(INC_RES_KEY,incrementResolution);
  607.     }
  608.  
  609.     /** Decodes the Slider instance.
  610.      * @see Codable#decode
  611.      */
  612.     public void decode(Decoder decoder) throws CodingException {
  613.         int version = decoder.versionForClassName("netscape.application.Slider");
  614.         super.decode(decoder);
  615.  
  616.         target = (Target)decoder.decodeObject(TARGET_KEY);
  617.         backgroundImage = (Image)decoder.decodeObject(BACKGROUND_IMAGE_KEY);
  618.         knobImage = (Image)decoder.decodeObject(KNOB_IMAGE_KEY);
  619.         backgroundColor = (Color)decoder.decodeObject(BACKGROUNDC_KEY);
  620.  
  621.         command = decoder.decodeString(COMMAND_KEY);
  622.  
  623.         value = decoder.decodeInt(VALUE_KEY);
  624.         minValue = decoder.decodeInt(MINVALUE_KEY);
  625.         maxValue = decoder.decodeInt(MAXVALUE_KEY);
  626.         knobHeight = decoder.decodeInt(KNOB_HEIGHT_KEY);
  627.         grooveHeight = decoder.decodeInt(GROOVE_HEIGHT_KEY);
  628.  
  629.         setBorder((Border)decoder.decodeObject(BORDER_KEY));
  630.  
  631.         enabled = decoder.decodeBoolean(ENABLED_KEY);
  632.         imageDisplayStyle = decoder.decodeInt(IMAGEDISP_KEY);
  633.         if(version > 1)
  634.             incrementResolution = decoder.decodeInt(INC_RES_KEY);
  635.         else
  636.             incrementResolution = 20;
  637.     }
  638.  
  639.     void _setupKeyboard() {
  640.         removeAllCommandsForKeys();
  641.         setCommandForKey(INCREASE_VALUE,KeyEvent.RIGHT_ARROW_KEY,View.WHEN_SELECTED);
  642.         setCommandForKey(DECREASE_VALUE,KeyEvent.LEFT_ARROW_KEY,View.WHEN_SELECTED);
  643.         setCommandForKey(INCREASE_VALUE,'+',View.WHEN_SELECTED);
  644.         setCommandForKey(DECREASE_VALUE,'-',View.WHEN_SELECTED);
  645.     }
  646.  
  647.     /** Overriden to return <b>true</b>.
  648.       *
  649.       */
  650.     public boolean canBecomeSelectedView() {
  651.         return true;
  652.     }
  653.  
  654.     /** Overriden to increase / decrease the value **/
  655.     public void performCommand(String command, Object data) {
  656.       int newValue;
  657.       if(INCREASE_VALUE.equals(command)) {
  658.           newValue = value() + (int)Math.rint(((double)(maxValue - minValue) / (double)incrementResolution));
  659.           if(newValue > maxValue)
  660.               newValue = maxValue;
  661.           setValue(newValue);
  662.           sendCommand();
  663.       } else if(DECREASE_VALUE.equals(command)) {
  664.           newValue = value() - (int)Math.rint(((double)(maxValue - minValue) / (double)incrementResolution));
  665.           if(newValue < minValue)
  666.               newValue = minValue;
  667.           setValue(newValue);
  668.           sendCommand();
  669.       }
  670.     }
  671.  
  672.     /** Return the increment used by keyboard UI
  673.       * The default increment is 20. This means that the user will have
  674.       * to press a key 20 times to go from the minValue to the maxValue.
  675.       * @see #setIncrementResolution
  676.       *
  677.       */
  678.     public int incrementResolution() {
  679.         return incrementResolution;
  680.     }
  681.  
  682.     /** Set the value increment
  683.       *
  684.       */
  685.     public void setIncrementResolution(int aValue) {
  686.         incrementResolution = aValue;
  687.     }
  688.  
  689.     /** Implementation of the FormElement interface
  690.       *
  691.       */
  692.     public String formElementText() {
  693.         return Integer.toString(value());
  694.     }
  695. }
  696.